import Fly from "flyio/dist/npm/wx"
import toast from "@/utils/toast.js"
const fly = new Fly()

fly.config.baseURL = 'https://api-hmugo-web.itheima.net/api/public/v1'

// 请求拦截器
fly.interceptors.request.use(request => {
  return request
})

// 响应拦截器
fly.interceptors.response.use(
  response => {
  return response.data
  },
  err => {
    toast.err('网络错误')
    return Promise.reject('响应失败')
  }
)

export default fly